package threadPool.threadExecutePool;

import threadPool.BlockingQueueTest;

import java.util.concurrent.BlockingQueue;

/**
 * Description  ${todo}
 *
 * @ClassName ${type_name}
 * @Copyright 炫彩互动
 * @Project ${project_name}
 * @Author ${user}
 * @Create Date  ${date}
 * @Modified by none
 * @Modified Date
 */

public class Thread1 extends Thread {
    BlockingQueue<Integer> blockingQueue;

    public Thread1() {}

    public Thread1(BlockingQueue blockingQueue) {
        this.blockingQueue = blockingQueue;
    }

    @Override
    public void run() {
        while(true){
            try {
                blockingQueue.put(BlockingQueueTest.addI());
                System.out.println("生产者:"+BlockingQueueTest.getI());
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
